<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Create an instance of AMQPConnection</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="amqpconnection.connect.html">AMQPConnection::connect</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="amqpconnection.disconnect.html">AMQPConnection::disconnect</a></div>
 <div class="up"><a href="class.amqpconnection.html">AMQPConnection</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="amqpconnection.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">AMQPConnection::__construct</h1>
  <p class="verinfo">(PECL amqp &gt;= Unknown)</p><p class="refpurpose"><span class="refname">AMQPConnection::__construct</span> &mdash; <span class="dc-title">Create an instance of AMQPConnection</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-amqpconnection.construct-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>AMQPConnection::__construct</strong></span>
    ([ <span class="methodparam"><span class="type">array</span> <code class="parameter">$credentials</code><span class="initializer"> = array()</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Creates an <a href="class.amqpconnection.html" class="classname">AMQPConnection</a> instance representing a connection to an AMQP broker.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-amqpconnection.construct-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">credentials</code></em></dt>

     <dd>

      <p class="para">
       The <em><code class="parameter">credentials</code></em> is an optional array of credential information for connecting to the AMQP
       broker.
      </p>
      <table class="doctable table">
       <caption><strong>Supported indexes</strong></caption>
       
        <thead>
         <tr>
          <th>key</th>
          <th>Description</th>
          <th>Default value</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td><em class="emphasis">host</em></td>
          <td>The host to connect too <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">Max 1024 characters</span></p></blockquote></td>
          <td><a href="amqp.configuration.html#ini.amqp.host" class="link">amqp.host</a></td>
         </tr>

         <tr>
          <td><em class="emphasis">port</em></td>
          <td>Port on the host</td>
          <td><a href="amqp.configuration.html#ini.amqp.port" class="link">amqp.port</a></td>
         </tr>

         <tr>
          <td><em class="emphasis">vhost</em></td>
          <td>The virtual host on the host <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">Max 128 characters</span></p></blockquote></td>
          <td><a href="amqp.configuration.html#ini.amqp.vhost" class="link">amqp.vhost</a></td>
         </tr>

         <tr>
          <td><em class="emphasis">login</em></td>
          <td>The login name to use. <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">Max 128 characters</span></p></blockquote></td>
          <td><a href="amqp.configuration.html#ini.amqp.login" class="link">amqp.login</a></td>
         </tr>

         <tr>
          <td><em class="emphasis">password</em></td>
          <td>Password <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">Max 128 characters</span></p></blockquote></td>
          <td><a href="amqp.configuration.html#ini.amqp.password" class="link">amqp.password</a></td>
         </tr>

        </tbody>
       
      </table>

      <p class="para">All other keys will be ignored.</p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-amqpconnection.construct-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   An AMQPConnection object.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-amqpconnection.construct-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Throws <strong class="classname">AMQPException</strong> exception on parameter parsing
   failures, and option errors.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-amqpconnection.construct-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-4097">
    <p><strong>Example #1 <span class="methodname"><strong>AMQPConnection::__construct()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;Create&nbsp;a&nbsp;connection&nbsp;using&nbsp;the&nbsp;INI&nbsp;values&nbsp;*/<br /></span><span style="color: #0000BB">$connection1&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AMQPConnection</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/*&nbsp;Specifying&nbsp;all&nbsp;keys&nbsp;*/<br /></span><span style="color: #0000BB">$connection2&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">AMQPConnection</span><span style="color: #007700">(array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'host'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'example.host'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'vhost'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'/'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'port'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">5763</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'login'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'user'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'password'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">'password'<br /></span><span style="color: #007700">));<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-amqpconnection.construct-notes">
  <h3 class="title">注释</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    A connection will not be established until <span class="methodname"><a href="amqpconnection.connect.html" class="methodname">AMQPConnection::connect()</a></span> is called.
   </p>
  </p></blockquote>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="amqpconnection.connect.html">AMQPConnection::connect</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="amqpconnection.disconnect.html">AMQPConnection::disconnect</a></div>
 <div class="up"><a href="class.amqpconnection.html">AMQPConnection</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
